<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>sock: E:/git/sock/sock/base/exception.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">sock
   &#160;<span id="projectnumber">v0.11</span>
   </div>
   <div id="projectbrief">C++ Network Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.10 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_885cc87fac2d91e269af0a5a959fa5f6.html">E:</a></li><li class="navelem"><a class="el" href="dir_4e091ed8704426a7a4980368ba259fde.html">git</a></li><li class="navelem"><a class="el" href="dir_99ede9081e3122cb31ab1bd7b142cd6c.html">sock</a></li><li class="navelem"><a class="el" href="dir_7c33e989e8c050d7b2ba91a16c41033d.html">sock</a></li><li class="navelem"><a class="el" href="dir_be62d2f8113bf3525ba6c014f1c98bce.html">base</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">exception.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="exception_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/******************************************************************************</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * Name         : exception.h</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * Author       : 671643387</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * Date         : 2015年10月5日</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> * Description  : 异常类</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> *****************************************************************************/</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;</div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#ifndef SOCK_BASE_EXCEPTION_H_</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#define SOCK_BASE_EXCEPTION_H_</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;</div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &lt;exception&gt;</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;</div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacesock.html">sock</a></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;{</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;    <span class="keyword">namespace </span>base</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;    {</div>
<div class="line"><a name="l00021"></a><span class="lineno"><a class="line" href="classsock_1_1base_1_1_exception.html">   21</a></span>&#160;        <span class="keyword">class </span><a class="code" href="classsock_1_1base_1_1_exception.html">Exception</a> : <span class="keyword">public</span> std::exception</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;        {</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;        <span class="keyword">public</span>:</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;            <a class="code" href="classsock_1_1base_1_1_exception.html#a381ac0f784ffa0611e5638efe2f69497">Exception</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;            <span class="keyword">explicit</span> <a class="code" href="classsock_1_1base_1_1_exception.html#a381ac0f784ffa0611e5638efe2f69497">Exception</a>(<span class="keywordtype">int</span> <a class="code" href="classsock_1_1base_1_1_exception.html#ad54a96e64930816281ef5322c2ea7515">code</a>);</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;            <span class="keyword">explicit</span> <a class="code" href="classsock_1_1base_1_1_exception.html#a381ac0f784ffa0611e5638efe2f69497">Exception</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* errmsg);</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;            <a class="code" href="classsock_1_1base_1_1_exception.html#a381ac0f784ffa0611e5638efe2f69497">Exception</a>(<span class="keywordtype">int</span> code, <span class="keyword">const</span> <span class="keywordtype">char</span>* errmsg);</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;            <a class="code" href="classsock_1_1base_1_1_exception.html#a381ac0f784ffa0611e5638efe2f69497">Exception</a>(<span class="keyword">const</span> <a class="code" href="classsock_1_1base_1_1_exception.html">Exception</a>&amp; exception);</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;            <span class="keyword">virtual</span> <a class="code" href="classsock_1_1base_1_1_exception.html#aa7eefb5a6efa0a981393a29a299f387f">~Exception</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;        <span class="keyword">public</span>:</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;</div>
<div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="classsock_1_1base_1_1_exception.html#ad54a96e64930816281ef5322c2ea7515">   59</a></span>&#160;            <span class="keywordtype">int</span> <a class="code" href="classsock_1_1base_1_1_exception.html#ad54a96e64930816281ef5322c2ea7515">code</a>(<span class="keywordtype">void</span>)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> code_; }</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;            </div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;<span class="preprocessor">#if defined(__WINDOWS__)</span></div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;            <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* what(<span class="keywordtype">void</span>)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> error_.c_str(); }</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;<span class="preprocessor">#elif defined(__LINUX__)</span></div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;            <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* what(<span class="keywordtype">void</span>) const noexcept { <span class="keywordflow">return</span> error_.c_str(); }</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;        <span class="keyword">private</span>:</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;            <span class="keywordtype">int</span> code_;</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;            std::string error_;</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;        };</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;    }</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;}</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* SOCK_BASE_EXCEPTION_H_ */</span><span class="preprocessor"></span></div>
<div class="ttc" id="classsock_1_1base_1_1_exception_html_ad54a96e64930816281ef5322c2ea7515"><div class="ttname"><a href="classsock_1_1base_1_1_exception.html#ad54a96e64930816281ef5322c2ea7515">sock::base::Exception::code</a></div><div class="ttdeci">int code(void) const </div><div class="ttdoc">获取错误码 </div><div class="ttdef"><b>Definition:</b> exception.h:59</div></div>
<div class="ttc" id="namespacesock_html"><div class="ttname"><a href="namespacesock.html">sock</a></div><div class="ttdef"><b>Definition:</b> atomic.h:17</div></div>
<div class="ttc" id="classsock_1_1base_1_1_exception_html"><div class="ttname"><a href="classsock_1_1base_1_1_exception.html">sock::base::Exception</a></div><div class="ttdoc">异常类 </div><div class="ttdef"><b>Definition:</b> exception.h:21</div></div>
<div class="ttc" id="classsock_1_1base_1_1_exception_html_aa7eefb5a6efa0a981393a29a299f387f"><div class="ttname"><a href="classsock_1_1base_1_1_exception.html#aa7eefb5a6efa0a981393a29a299f387f">sock::base::Exception::~Exception</a></div><div class="ttdeci">virtual ~Exception(void)</div><div class="ttdoc">析构函数 </div><div class="ttdef"><b>Definition:</b> exception.cc:47</div></div>
<div class="ttc" id="classsock_1_1base_1_1_exception_html_a381ac0f784ffa0611e5638efe2f69497"><div class="ttname"><a href="classsock_1_1base_1_1_exception.html#a381ac0f784ffa0611e5638efe2f69497">sock::base::Exception::Exception</a></div><div class="ttdeci">Exception(void)</div><div class="ttdoc">构造函数 </div><div class="ttdef"><b>Definition:</b> exception.cc:13</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.10
</small></address>
</body>
</html>
